<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <p>{{ count }}</p>
      <!-- 当事件足够简单的时候，可以将事件内联 -->
      <!-- <button @click="count++">btn</button> -->

      <!-- 括号可以加也可以不加 -->
      <!-- 但是如果想使用event，要么不加括号，要么传入$event -->
      <button v-on:click="fn($event)">btn</button>
    </div>

    <script src="../Vue.js"></script>
    <script>
      new Vue({
        el: "#app",
        data: {
          count: 1,
        },
        methods: {
          fn(e) {
            this.count++;
          },
        },
      });
    </script>
  </body>
</html>
